import {reqCategoryList,getBannerList, getFloorList} from '@/api'
// import {getBannerList} from '@/api/mockRequest'
const actions={
    //获取导航三级列表数组
    async getreqCategoryList($store){
        let newList = await reqCategoryList();
        let result=newList.data
        // console.log(result)
        if (result.code==200) {
            $store.commit("GETREQCATEGORYLIST",result.data);
            // console.log(result.data)
        }
    },
    //获取轮播图列表
    async getBannerList($store){
        let newList=await getBannerList();
        // console.log(newList);
        let result=newList.data;
        if (result.code==200) {
            $store.commit("GETBANNERLIST",result.data);
            // console.log(result.data)
        }
    },
    //获取floor组件数据组
    async getFloorList($store){
        let newList=await getFloorList();
        // console.log(newList)
        let result=newList.data;
        if (result.code==200) {
            $store.commit('GETFLOORLIST',result.data);
            // console.log(result.data)
        }
    }
    
};
const mutations={
    //获取导航三级列表数组
    GETREQCATEGORYLIST(state,catego){
        state.reqCategoryList=catego.slice(0,15);
    },
    //轮播图
    GETBANNERLIST(state,banner){
        state.reqBannerList=banner;
        // console.log( state.reqBannerList)
    },
    //floor组件
    GETFLOORLIST(state,floor){
        state.reqFloorList=floor;
        // console.log( state.reqFloorList)
    }
};
const state={
    //三级列表
    reqCategoryList:[],
    //轮播图
    reqBannerList:[],
    //floor
    reqFloorList:[]
};
const getters={

};

export default {actions,mutations,state,getters}